package itcast.lsf.ur;

import itcast.lsf.dao.imp.UserDaoImp;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class FactoryTest {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext cpac = new ClassPathXmlApplicationContext("bean.xml");
        UserDaoImp u = (UserDaoImp) cpac.getBean("u");//立即加载下，无参构造了一个UserDaoImp
        u.toSave();//工厂中new了一个对象，返回值
        System.out.println(u);//普通方法创建的bean对象
        System.out.println("=================333");

        UserDaoImp aStatic = (UserDaoImp) cpac.getBean("static");
        System.out.println(aStatic);//工厂中new了一个对象，返回值
    }
}
